<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>for_of循环</title>
</head>
<body>
  <button>按钮1</button>
  <button>按钮2</button>
  <button>按钮3</button>

<!--
for(let value of target){}循环遍历
  1. 遍历数组
  2. 遍历Set
  3. 遍历Map
  4. 遍历字符串
  5. 遍历伪数组
-->
<script type="text/javascript">
  let arr = [1,2,3,4,5]
  for(let num of arr){
      console.log(num)
  }
  let set = new Set([1,2,3,4,5])
  for(let num of set){
      console.log(num)
  }
  let map = new Map([['name','limi'],['age', 31]])
  for(let num of map){
      console.log(num)
  }
  let str = 'abcdefg'
  for(let num of str){
      console.log(num)
  }
  const btns = document.getElementsByTagName('button')
  //遍历伪数组
  for(let btn of btns) {
    console.log(btn)
  }
</script>
  
</body>
</html>